home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / disk / misc / ADFlib.lha / Lib / adf_str.h < prev    next >
C/C++ Source or Header  |  1999-05-23  |  4KB  |  188 lines

  1. #ifndef _ADF_STR_H
  2. #define _ADF_STR_H 1
  3.  
  4. /*
  5.  *  ADF Library. (C) 1997-1998 Laurent Clevy
  6.  *
  7.  *  adf_str.h
  8.  *
  9.  *  structures/constants definitions
  10.  */
  11.  
  12. #include<stdio.h>
  13.  
  14. #include"adf_defs.h"
  15. #include"adf_blk.h"
  16. #include"adf_err.h"
  17.  
  18. /* ----- VOLUME ----- */
  19.  
  20. struct Volume {
  21.     struct Device* dev;
  22.  
  23.     SECTNUM firstBlock;     /* first block of data area (from beginning of device) */
  24.     SECTNUM lastBlock;      /* last block of data area  (from beginning of device) */
  25.     SECTNUM rootBlock;      /* root block (from firstBlock) */
  26.  
  27.     char dosType;           /* FFS/OFS, DIRCACHE, INTERNATIONAL */
  28.     BOOL bootCode;
  29.     BOOL readOnly;
  30.     int datablockSize;      /* 488 or 512 */
  31.  
  32.     char *volName;
  33.  
  34.     BOOL mounted;
  35.  
  36.     long bitmapSize;             /* in blocks */
  37.     SECTNUM *bitmapBlocks;       /* bitmap blocks pointers */
  38.     struct bBitmapBlock **bitmapTable;
  39.     BOOL *bitmapBlocksChg;
  40.  
  41.     SECTNUM curDirPtr;
  42. };
  43.  
  44.  
  45. struct Partition {
  46.     long startCyl;
  47.     long lenCyl;
  48.     char* volName;
  49.     int volType;
  50. };
  51.  
  52. /* ----- DEVICES ----- */
  53.  
  54. #define DEVTYPE_FLOPDD         1
  55. #define DEVTYPE_FLOPHD         2
  56. #define DEVTYPE_HARDDISK     3
  57. #define DEVTYPE_HARDFILE     4
  58.  
  59. struct Device {
  60.     int devType;               /* see below */
  61.     BOOL readOnly;
  62.     long size;                 /* in bytes */
  63.  
  64.     int nVol;                  /* partitions */
  65.     struct Volume** volList;  
  66.     
  67.     long cylinders;            /* geometry */
  68.     long heads;
  69.     long sectors;
  70.  
  71.     BOOL isNativeDev;
  72.     void *nativeDev;
  73. };
  74.  
  75.  
  76. /* ----- FILE ----- */
  77.  
  78. struct File {
  79.     struct Volume *volume;
  80.  
  81.     struct bFileHeaderBlock* fileHdr;
  82.     void *currentData;
  83.     struct bFileExtBlock* currentExt;
  84.  
  85.     long nDataBlock;
  86.     SECTNUM curDataPtr;
  87.     unsigned long pos;
  88.  
  89.     int posInDataBlk;
  90.     int posInExtBlk;
  91.     BOOL eof, writeMode;
  92.     };
  93.  
  94.  
  95. /* ----- ENTRY ---- */
  96.  
  97. struct Entry{
  98.     int type;
  99.     char* name;
  100.     SECTNUM sector;
  101.     SECTNUM real;
  102.     SECTNUM parent;
  103.     char* comment;
  104.     unsigned long size;
  105.     long access;
  106.     int year, month, days;
  107.     int hour, mins, secs;
  108. };
  109.  
  110. struct CacheEntry{
  111.     long header, size, protect;
  112.     short days, mins, ticks;
  113.     signed char type;
  114.     char nLen, cLen;
  115.     char name[MAXNAMELEN+1], comm[MAXCMMTLEN+1];
  116. //    char *name, *comm;
  117.  
  118. };
  119.  
  120.  
  121.  
  122.  
  123. struct DateTime{
  124.     int year,mon,day,hour,min,sec;
  125. };
  126.  
  127. /* ----- ENVIRONMENT ----- */
  128.  
  129. #define PR_VFCT        1
  130. #define PR_WFCT        2
  131. #define PR_EFCT        3
  132. #define PR_NOTFCT    4
  133. #define PR_USEDIRC    5
  134.  
  135. struct Env{
  136.     void (*vFct)(char*);       /* verbose callback function */
  137.     void (*wFct)(char*);       /* warning callback function */
  138.     void (*eFct)(char*);       /* error callback function */
  139.     void (*notifyFct)(SECTNUM, int);
  140.     BOOL useDirCache;
  141.  
  142.     void *nativeFct;
  143. };
  144.  
  145.  
  146.  
  147. struct List{         /* generic linked tree */
  148.     void *content;
  149.     struct List* subdir;
  150.     struct List* next;
  151. };
  152.  
  153.  
  154.  
  155. struct bEntryBlock {
  156. /*000*/    long    type;        /* T_HEADER == 2 */
  157. /*004*/    long    headerKey;    /* current block number */
  158.         long    r1[3];
  159. /*014*/    unsigned long    checkSum;
  160. /*018*/    long    hashTable[HT_SIZE];
  161.         long    r2[2];
  162. /*140*/    long    access;    /* bit0=del, 1=modif, 2=write, 3=read */
  163. /*144*/    long    byteSize;
  164. /*148*/    char    commLen;
  165. /*149*/    char    comment[MAXCMMTLEN+1];
  166.         char    r3[91-(MAXCMMTLEN+1)];
  167. /*1a4*/    long    days;
  168. /*1a8*/    long    mins;
  169. /*1ac*/    long    ticks;
  170. /*1b0*/    char    nameLen;
  171. /*1b1*/    char    name[MAXNAMELEN+1];
  172.         long    r4;
  173. /*1d4*/    long    realEntry;
  174. /*1d8*/    long    nextLink;
  175.         long    r5[5];
  176. /*1f0*/    long    nextSameHash;
  177. /*1f4*/    long    parent;
  178. /*1f8*/    long    extension;
  179. /*1fc*/    long    secType;
  180.     };
  181.  
  182.  
  183. #define ENV_DECLARATION struct Env adfEnv
  184.  
  185.  
  186. #endif /* _ADF_STR_H */
  187. /*##########################################################################*/
  188.